/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package bpel2rep.version.impl;

import bpel2rep.version.VersionId;
import bpel2rep.version.VersionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Id</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link bpel2rep.version.impl.VersionIdImpl#getMajorID <em>Major ID</em>}</li>
 *   <li>{@link bpel2rep.version.impl.VersionIdImpl#getMinorID <em>Minor ID</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class VersionIdImpl extends EObjectImpl implements VersionId {
	/**
	 * The default value of the '{@link #getMajorID() <em>Major ID</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMajorID()
	 * @generated
	 * @ordered
	 */
	protected static final int MAJOR_ID_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getMajorID() <em>Major ID</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMajorID()
	 * @generated
	 * @ordered
	 */
	protected int majorID = MAJOR_ID_EDEFAULT;

	/**
	 * The default value of the '{@link #getMinorID() <em>Minor ID</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinorID()
	 * @generated
	 * @ordered
	 */
	protected static final int MINOR_ID_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getMinorID() <em>Minor ID</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinorID()
	 * @generated
	 * @ordered
	 */
	protected int minorID = MINOR_ID_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected VersionIdImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return VersionPackage.Literals.VERSION_ID;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getMajorID() {
		return majorID;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMajorID(int newMajorID) {
		int oldMajorID = majorID;
		majorID = newMajorID;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, VersionPackage.VERSION_ID__MAJOR_ID, oldMajorID, majorID));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getMinorID() {
		return minorID;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMinorID(int newMinorID) {
		int oldMinorID = minorID;
		minorID = newMinorID;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, VersionPackage.VERSION_ID__MINOR_ID, oldMinorID, minorID));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case VersionPackage.VERSION_ID__MAJOR_ID:
				return new Integer(getMajorID());
			case VersionPackage.VERSION_ID__MINOR_ID:
				return new Integer(getMinorID());
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case VersionPackage.VERSION_ID__MAJOR_ID:
				setMajorID(((Integer)newValue).intValue());
				return;
			case VersionPackage.VERSION_ID__MINOR_ID:
				setMinorID(((Integer)newValue).intValue());
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case VersionPackage.VERSION_ID__MAJOR_ID:
				setMajorID(MAJOR_ID_EDEFAULT);
				return;
			case VersionPackage.VERSION_ID__MINOR_ID:
				setMinorID(MINOR_ID_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case VersionPackage.VERSION_ID__MAJOR_ID:
				return majorID != MAJOR_ID_EDEFAULT;
			case VersionPackage.VERSION_ID__MINOR_ID:
				return minorID != MINOR_ID_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (majorID: ");
		result.append(majorID);
		result.append(", minorID: ");
		result.append(minorID);
		result.append(')');
		return result.toString();
	}

} //VersionIdImpl
